let layer;
let form;
layui.use(['layer', 'form'], function () {
    layer = layui.layer
    form = layui.form

    function user() {

        $.ajax({
            url: '/my/userinfo',

            success: function (res) {
                if (res.status == 0) {
                    form.val('user', res.data)
                }
            }
        })
    }
    user()




    $('form').on('submit', function (e) {
        e.preventDefault()

        let data = form.val('user')

        $.ajax({
            url: '/my/userinfo',
            data: data,
            type: 'POST',
            success: function (res) {
                layer.msg(res.message)


                window.parent.getInfo()

            }
        })
    })

    $('form').on('reset', function (e) {
        e.preventDefault()
        user()
    })

})